package 草稿包;

import java.lang.*;
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int[] q=new int[n];
        for(int i=0;i<n;i++){
            q[i]=in.nextInt();
        }
        if(n==0){
            System.out.println(0);
        }
        if(n<=2){
            System.out.println(1);
        }
        int cnt=1;
        //判断变化趋势是否发生变化
        int oldflag=(q[1]-q[0])==0?0:((q[1]-q[0])>0?1:-1);
        for(int i=1;i<n-1;i++){
            int newflag=(q[i+1]-q[i])==0?0:((q[i+1]-q[i])>0?1:-1);
            if(newflag!=0&&newflag!=oldflag){
                cnt++;
                i++;
                if(i<n-1){
                    int tmp=(q[i+1]-q[i])==0?0:((q[i+1]-q[i])>0?1:-1);
                    while(tmp==0){//直到找到不为0的为止
                        i++;
                        if(i==n-1)break;
                        tmp=(q[i+1]-q[i])==0?0:((q[i+1]-q[i])>0?1:-1);
                    }
                    if(tmp!=0)
                        oldflag=tmp;
                }
            }
        }

        String str1 = new String();
        str1.equals(0);
        System.out.println(cnt);
    }

}